﻿#light

module PubSim.Tap

open System
open Microsoft.FSharp.Control

/// Tap type definition ... used to set status of whether the bar tap is in use
/// or not.
type Tap(initValue : bool) =
    let mutable tap = initValue
    let lockObj = new Object()

    member c.UseTap() =
        lock lockObj (fun() ->
            if tap = true then
                tap <- false
                true
            else 
                false
        )
    member c.ReleaseTap() =
        tap <- true
        ignore()
